// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
import QtQuick 1.1
import "../Components"

AndroidItem {
    id: _root
    width: 720 * viewScale
    height: 1134 * viewScale
    mouseAccepted: false

    property variant notificationItemNormalPath: []      //通知アイテム
    property variant notificationItemPressedPath: []     //通知アイテム
    property variant notificationTrackingBgPath: []      //通知背景

    property bool isViewing: false
    property real itemWidth: _root.width
    property real itemHeight: 128 * viewScale

    property real moveToY: 0    // 移動先
    function moveTo(y){
        if(_anim.running){
            _anim.stop();
        }
        moveToY = y;
        _anim.start();
    }

    onHeightChanged: {
        //高さの変化を回転とみなす
        _root.y = -1 * _root.height;
    }

    //表示
    onVisibleChanged: {

    }

    //背景
    Image{
        id: _background
        width: _root.width
        height: _root.height - (128 * viewScale) // 1008 * viewScale
        cache: false
        source: notificationTrackingBgPath[0]
    }

    //カレンダー表示している所
    Image {
        width: _root.width
        height: 71 * viewScale
        source: "images/notification_bg_upper.png"
        smooth: true
        Image {
            width: 260 * viewScale
            height: 71 * viewScale
            anchors.horizontalCenter: parent.horizontalCenter
            source: "images/notification_bg_upper_msg.png"
        }
    }

    Column{
        anchors.bottom: parent.bottom

        //１つめのアイテム
        ImageButton {
            id: _item1
            width: itemWidth
            height: itemHeight
            imageIdle: notificationItemNormalPath[0]
            imagePress: notificationItemPressedPath[0]
        }

        //隙間
        Rectangle{
            width: itemWidth
            height: 1
            color: "#000000"
        }

        //２つめのアイテム
        Row{
            Image {
                width: itemHeight
                height: itemHeight
                source: "images/notification_item_icon.png"
            }
            ImageButton {
                id: _item2
                width: itemWidth - itemHeight
                height: itemHeight
                imageIdle: notificationItemNormalPath[0]
                imagePress: notificationItemPressedPath[0]
            }
        }
        //下の領域をうめる
        Image {
            width: _root.width
            height: 66 * viewScale
            source: "images/notification_bg_clear.png"
            smooth: true
            Image {
                width: 34 * viewScale
                height: 66 * viewScale
                anchors.horizontalCenter: parent.horizontalCenter
                source: "images/notification_bg_clear_mark.png"
            }
        }
        Image {
            width: _root.width
            height: 66 * viewScale
            source: "images/notification_bg_lower.png"
            smooth: true
            Image {
                width: 30 * viewScale
                height: 66 * viewScale
                anchors.horizontalCenter: parent.horizontalCenter
                source: "images/notification_bg_lower_mark.png"
            }
        }
    }


    NumberAnimation {
        id: _anim
        target: _root
        property: "y"
        to: moveToY
        duration: 300
        easing.type: Easing.InOutQuad
        running: false
    }


    states: [
        State {
            name: "Land"
            when: !isPortrait
            PropertyChanges {
                target: _background
                source: _root.notificationTrackingBgPath[1]
            }
            PropertyChanges {
                target: _item1
                imageIdle: _root.notificationItemNormalPath[1]
                imagePress: _root.notificationItemPressedPath[1]
            }
            PropertyChanges {
                target: _item2
                imageIdle: _root.notificationItemNormalPath[1]
                imagePress: _root.notificationItemPressedPath[1]
            }
        }
    ]
}
